<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <el-input
          v-model="query.name"
          placeholder="请输入任务名称"
          clearable
          size="small"
          style="width: 200px;"
          class="filter-item"
          @keyup.enter.native="toQuery"
        />
        <el-select
          v-model="query.status"
          style="width: 200px;"
          placeholder="请选择还原状态"
          class="filter-item"
          clearable
        >
          <el-option v-for="val in statusList" :key="val" :label="val" :value="val" />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
      <!-- 功能按钮 -->
      <crudOperation :permission="permission" />
    </div>

    <!--表格渲染-->
    <el-table ref="table" :data="tableList" style="width: 100%;">
      <el-table-column type="selection" width="55" />
      <el-table-column prop="versions" label="文件名称" />
      <el-table-column prop="details" label="文件路径" />
      <el-table-column prop="file" label="发布状态" />
      <el-table-column prop="status" label="备注" />
      <el-table-column prop="updateTime" label="发布时间" />
      <el-table-column label="操作">
        <template>
          <el-button size="mini" type="text" @click="packFlag=true">版本回退</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination :total="2" />
    <el-dialog append-to-body :close-on-click-modal="false" :before-close="packClose" :visible.sync="packFlag" title="还原" width="800px">
      <el-table ref="table" :data="tableList1" style="width: 100%;">
        <el-table-column prop="versions" label="文件名称" />
        <el-table-column prop="details" label="文件路径" />
        <el-table-column prop="file" label="版本注释" />
        <el-table-column prop="status" label="发布时间" />
        <el-table-column prop="updateTime" label="操作" />
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="text" @click="packClose">取消</el-button>
        <el-button type="primary" @click="packClose">确认</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/expand/golive/rollback/CRUD.operation.vue'
// import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultCrud = CRUD({
  title: '还原',
  url: ''
})
export default {
  components: { crudOperation, rrOperation, pagination },
  mixins: [presenter(defaultCrud), header(), crud()],
  data() {
    return {
      statusList: ['代报盘', '报盘中', '报盘成功', '报盘失败', '取消报盘中', '已冲账'],
      tableList: [
        {
          name: '1',
          versions: '数据迁移',
          details: '/dataTransfer',
          file: '添加更新',
          status: '',
          updateTime: '预览'
        },
        {
          name: '1',
          versions: '数据迁移',
          details: '/dataTransfer',
          file: '添加更新',
          status: '',
          updateTime: '预览'
        }
      ],
      tableList1: [
        {
          name: '1',
          versions: '数据迁移',
          details: '/dataTransfer',
          file: 'testData',
          status: '2023-06-21 14:22:54',
          updateTime: '还原'
        },
        {
          name: '2',
          versions: '数据迁移',
          details: '/dataTransfer',
          file: 'menu',
          status: '2023-06-21 14:22:54',
          updateTime: '还原'
        }
      ],
      permission: {
        add: ['admin', 'rollback:add'],
        edit: ['admin', 'rollback:edit'],
        del: ['admin', 'rollback:del']
      },
      form: {
        ip: '',
        details: ''
      },
      packFlag: false,
      ipList: ['1.0.0', '1.0.3', '1.0.38', '1.0.5'],
      fileList: ['menu', 'bigData', 'monitor', 'process']
    }
  },
  methods: {
    packClose() {
      this.packFlag = false
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.el-input{
  width: 120px;
}
</style>
